<?php
use yii\helpers\Html;
use yii\grid\GridView;
?>

<blockquote class="meta">
<h2><?php echo Yii::t('Message','Sent Box') ?></h2>
</blockquote>
<br>
<form method="post">
    <p style="text-align:left">
        <input type="submit" class="btn btn-default" name="submitDelete" value="<?php echo Yii::t('message/views', 'Delete')?>" > 
    </p>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            [
                'class' => 'yii\grid\CheckboxColumn',
                'headerOptions' => array('width'=>'33px','style'=>'text-align:center'),
                'checkboxOptions' => array('name' => 'select[]'),
                'options'=>array(
                    'style'=>'text-align:center',
                ),
            ],
            [
                'attribute'=>'message_id',
                'options'=>array(
                    'width'=>'120',
                    'style'=>'text-align:center',
                ),
            ],
            [
                'attribute'=>'title',
                'format'=>'raw',
                'value'=>function ($model, $key, $index, $column){
                    return Html::a($model->title, yii::$app->urlManager->createUrl(['message/view','id'=>$model->message_id]));
                    },
            ],
            [
                'attribute'=>'receiver_id',
                'value'=>function ($model, $key, $index, $column){
                    return $model->receiver->user_name;
                    },
                    'options'=>array(
                    'width'=>'120',
                    'style'=>'text-align:center',
                ),
            ],
            [
                'attribute'=>'create_date',
                    'options'=>array(
                    'width'=>'200',
                    'style'=>'text-align:center',
                ),
            ],
            [
                'class' => 'yii\grid\ActionColumn',
                'template'=>'{view} {delete}',
            ],

        ],
    ]); ?>
</form>
